#!/bin/sh

if [ -n "$CURRENT_PROJECT" ] && [ -d "/var/www/projects/$CURRENT_PROJECT" ]; then
    cd "/var/www/projects/$CURRENT_PROJECT"
    
    if [ $# -gt 0 ]; then
        exec "$@"
    else
        if [ -f "package.json" ]; then
            npm install && npm run dev
        else
            echo "No package.json found in $CURRENT_PROJECT"
            tail -f /dev/null
        fi
    fi
else
    echo "Project directory not found or CURRENT_PROJECT not set"
    tail -f /dev/null
fi 
